import request from '@/utils/request'

/**
 * 获取企业列表
 */
export function getEnterpriceListAPI(params) {
  return request({
    url: '/park/enterprise',
    params
  })
}

/**
 *  获取所属行业
 */
export function getIndustryListAPI() {
    return request({
        url: '/park/industry',
    })
}

/**
 * 添加企业
 */
export function addEnterpriseAPI(data) {
  return request({
    url: '/park/enterprise',
    method: 'post',
    data
  })
}

/**
 * 获取合同详情
 */
 export function getEnterpriseDetailAPI(id) {
  return request({
      url: `/park/enterprise/${id}`
  })
}

/**
* 更新企业
* @param {*} data
* @returns
*/
export function updateExterpriseAPI(data) {
  return request({
    url: '/park/enterprise',
    method: 'PUT',
    data
  })
}

/**
 * 删除企业
 */
export function deleteEnterpriseAPI(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'delete'
  })
}

/**
 * 获取可租赁的楼宇列表
 * @param {*} id
 * @returns
 */
 export function getRentBuildListAPI() {
  return request({
    url: '/park/rent/building'
  })
}

/**
 * 添加租赁合同
 */
export function addRentAPI(data) {
  return request({
    url: '/park/enterprise/rent',
    method: 'post',
    data
  })
}

/**
 * 获取展开的租赁合同，id是企业id
 */
export function getEnterpriseRentBuildingAPI(id) {
  return request({
    url: `/park/enterprise/rent/${id}`
  })
}

/**
 * 退租合同
 */
export function outRentAPI(id) {
  return request({
    url:`/park/enterprise/rent/${id}`,
    method: 'put'
  })
}

/**
 * 合同退租删除
 */
export function deleteOutRentAPI(id) {
  return request({
    url: `/park/enterprise/rent/${id}`,
    method: 'delete'
  })
}